const Router = require('koa-router')
const router = new Router()
const koaBody = require('koa-bodyparser');

const hou = require('../model/houguan')

router.prefix('/hou');


router.post('/publish',koaBody(), async ctx => {
      
      // 查询数据库获取推荐
      const rows = await hou.GETPUBLISH();
      console.log(rows)
      ctx.body = rows;

    }
)
router.post('/recipe',koaBody(), async ctx => {
      
    // 查询数据库获取推荐
    const rows = await hou.GETRECIPE();
    // console.log(rows)
    ctx.body = rows;

  }
)
router.post('/user',koaBody(), async ctx => {
      
    // 查询数据库获取推荐
    const rows = await hou.GETUSER();
    // console.log(rows)
    ctx.body = rows;

  }
)
router.post('/debark',koaBody(),async ctx=>{
    const username = ctx.request.body.username;
    const password = ctx.request.body.password;
    const rows = await hou.HOUDEBARK(username,password);
    ctx.body = rows;
})
router.post('/guan_user',koaBody(),async ctx=>{
    const rows=await hou.GETHOUUSER();
    ctx.body=rows;
})
  module.exports = router